<?php


namespace App\Console\Commands\Tasks;
use App\Services\Activity\NewYearService;
use App\Repositories\Activity\NewYearRepository;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class ActivityNewYearCommand extends Command
{
    protected $signature = 'task:activity_new_year';
    protected $description = '新年活动结算';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
//        sleep(20); //防止主从延迟读取的数据不准
//        $preMsg = '元旦活动结算:';
//        Log::error("$preMsg error :");
//        try {
//            $NewYear = new NewYearService();
//            $NewYear->receivePrize();
//            echo $preMsg;
//            // 是否结算了 结算给他添加礼物
//
//            //新年红包活动 start
//            $end_time = strtotime(date('Y-m-d H:i:00'));
//            $start_time = strtotime('-1 minute', $end_time);
//            app('repo_new_year')->hongbaoJoin($start_time, $end_time);
//
//            //新年活动 年兽结算
//            $repo_new_year = new NewYearRepository('nien');
//            $repo_new_year->nienSettle();
//
//            //新年红包活动 end
//        } catch (\Throwable $exception) {
//            Log::error("$preMsg error :". $exception->getMessage());
//        }

    }
}
